Home:ALL Converter>can i create a icon to start my cython compiled program (python)

can i create a icon to start my cython compiled program (python)

Ask Time:2017-04-23T17:43:10         Author:Cat

Json Formatter

python program compiled to cython

  • not open the terminal
  • point to my virtualenv
  • >>> import my_program

Instead would like to make it more user friendly and start the program from an icon

Author:Cat,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/43569559/can-i-create-a-icon-to-start-my-cython-compiled-program-python
DavidW :

I'm not sure what operating system you are on. However, the answer is simular for both.\n\nOn Windows:\n\nYou need to create a .bat file. The are already questions about how to do this to use Python. The .bat file is just a text file with a list of commands you want to execute (i.e. whatever you normally type into the command prompt). The Python line would be:\n\n C:\\path\\to\\python\\pythonw.exe -m my_program %*\n\n\npythonw instead of Python avoids creating a window. %* passes any command line arguments to your program (not necessary, but probably good practice). The -m version your program as the __main__ module.\n\nedit: -m doesn't work with compiled (Cython) modules. To run these you should do C:\\path\\to\\python\\pythonw.exe -c \"import my_program\" %* instead.\n\nThe .bat file should be executable by clicking on it.\n\nOn Linux (and OSX too, I think):\n\nYou want a shell script, instead of a .bat script. Again, it's just a list of commands to execute (so what you normally type in to the terminal). Your python line should be\n\npython -m my_program $@\n\n\nor (if my_program is a compiled module)\n\npython -c \"import my_program\" $@\n\n\nThe $@ is forwarding command line arguments. You then need to make the shell script executable. See this very comprehensive question. Once you've made it executable you should be able to click on it to run it.",
2017-04-23T18:55:51
yy